#include<stdio.h>
#include<stdlib.h>
int **pascal(int n);
int main(void)
{
	int i, j, n;
	int **array;
	scanf_s("%d", &n);
	while (n != 0)
	{
		array = pascal(n);
		if (array != NULL)
		{
			for (i = 0; i < n; i++)
			{
				int g;
				for (g = 0; g < n - i - 1; g++)
				{
					printf(" ");
				}
				for (j = 0; j < i; j++)
				{
					printf("%d ", array[i][j]);
				}
				printf("%d\n", array[i][j]);
			}
			for (i = 0; i < n; i++)
			{
				free(array[i]);
			}
			free(array);
			array = NULL;
			scanf_s("%d", &n);
		}
	}
	
	getchar();
	getchar();
	return 0;
}
int **pascal(int n)
{
	int **sz = (int **)malloc(sizeof(int *)*n);
	for (int t = 0; t < n; t++)
	{
		sz[t] = (int *)malloc(sizeof(int)*(n*2));
	}
	for (int t = 0; t < n; t++)
	{
		for (int k = 0; k < t + 1; k++)
		{
			if (t == 0 && k == 0)
				sz[t][k] = 1;
			if (k == 0 || k == t)
				sz[t][k] = 1;
			else
				sz[t][k] = sz[t - 1][k - 1] + sz[t - 1][k];
		}
	}
	return sz;
}
